--and made Notes self-removing (removed "Remove Notes" button)
--MemoNote changes to ShowNotes on option-click.
--MemoNoteButton pastes self to background, if it ain't…
--ShowNote is pared to the essence…
--Version 2.0 --- rev. 23 jan 1988 PSF
--Note buttons move in browse mode by click-dragging
--**********************
***
on setVersionID
global gVersionID
put "4.1.1" into gVersionID
initGlobals
end setversionID
on initGlobals
global gMoveNote, screenRect, clipRect, dragRect
global gNoteStyle, gNoteShowLines, gNoteTFont
global gNoteTSize, gGlobalInitFlag, gDoMeNoteRequireCmd
if gGlobalInitFlag is empty or gGlobalInitFlag is false then
set lockscreen to true
push card
go to card MemoNoteSettings of stack "memoNoteStack*4.0"
pop card
put "0,0,511,341" into screenRect
put true into gGlobalInitFlag
end if
end initGlobals
on NoteButtonMouseUp
global gVersionID
setVersionID
put the userlevel into templevel
set the userlevel to 5
put the id of the target into myID
if line 1 of the script of the target contains "4." then
if the optionkey is down then
--ΓÇóSends a killField Message to the Note Button selected, removing
-- both field and button.
--ΓÇóThe Note Button sends a KillNotes message up the chain when
-- clicked with the option Key down and the action is confirmed.
answer "Remove this Note?" with "Remove" or "Cancel"
if it = "Remove" then
set lockscreen to true
get the id of the target -- will only be a Note button
--ΓÇósend killField to card button id it
-- the button clears its field
set the visible of card field id (myID-1) to true
choose field Tool
click at the loc of card field id (myID-1)
domenu clear field
set the visible of card button id (myID+1) to true
choose button Tool
click at the loc of card button id (myID+1)
domenu clear button
--***
choose button tool
click at Loc of card button id it
domenu clear button
set cursor to 1
choose browse tool
set the userlevel to templevel
exit to hypercard
end if
set the userlevel to templevel
exit NoteButtonMouseUp
end if
put the visible of card field id (myID-1) into showing
showfield showing
else -- convert old button
set lockscreen to true
set cursor to 4
answer "Converting Old Button…"
put card field id (myID+2) into tempText
choose field tool
click at the loc of card field id (myID+2)
domenu "cut field"
domenu "paste field"
choose button tool
click at the loc of card button ID myID
domenu "cut button"
domenu "paste button"
put the id of card button (the number of buttons) into newId
get the script of card button id newId
put gVersionID after line 1 of it
set the script of card button id newId to it
click at the loc of card button ID (myID+1)
domenu "cut button"
domenu "paste button"
choose browse tool
put tempText into card field (the number of card fields)
end if
set the userlevel to templevel
end NoteButtonMouseUp
***
**********************
on MemoNote -- 6 Jan 88 ΓÇö MemoNotesΓäó by Peter Fraterdeus
set lockscreen to true
put the userlevel into templevel
set userlevel to 5
MagicCopy
global gVersionID
setVersionID
global gMoveNote, screenRect, clipRect, dragRect
global gNoteStyle, gNoteShowLines, gNoteTFont, gNoteTSize,gNoteTHeight, gRegisteredFlag
Show msg
put Msg into tempMsg
put "Click where you want the new Note... (or command-. to cancel)"
beep
set cursor to 2
set lockscreen to true
wait until the mouse is down -- click at note start
put False into DoMeFlag
if the optionKey is down then put True into DoMeFlag
get the mouseLoc
put item 1 of it into HMouse
put item 2 of it into VMouse
set cursor to 4
wait until the mouse is up -- drag to note size
get the mouseLoc
if abs(Hmouse-item 1 of it)>100 then
put abs(Hmouse-item 1 of it) into fieldWidth
else
put 162 into fieldWidth -- change these for different note size.
end if
if abs(Vmouse-item 2 of it)>62 then
put abs(Vmouse-item 2 of it) into fieldHeight
else
put 100 into fieldHeight -- change these for different note size.
end if
--ΓÇóΓÇóΓÇó Create the note ΓÇóΓÇóΓÇó
put the number of buttons into ButtonNum
put the number of card fields into FieldNum
put tempMsg
--ΓÇó Make Note Field
choose field tool
drag from HMouse,VMouse+16 to HMouse+fieldWidth, VMouse+fieldHeight with commandKey -- Draw the new Field
choose button tool -- this actually enables the new field
get the id of card field (the number of card fields)
set name of card field id it to "Note"&&it
put short name of card field id it into FieldName
put "card field id " before it
show it
put"*NoteFieldScript*"&gVersionID&return into NoteFieldScript
put"on MouseDown"&return after NoteFieldScript
put"send NoteFieldMouseDown"&return after NoteFieldScript
put"end MouseDown"&return after NoteFieldScript
set the script of it to NoteFieldScript
set style of it to gNoteStyle
set locktext of it to false
set showlines of it to gNoteShowLines
set textFont of it to gNoteTFont
set textSize of it to gNoteTSize
set textHeight of it to gNoteTHeight
put it into fieldID
put"Note created"&&the short time&& the short Date&return into NoteText
if gRegisteredflag = false or gRegisteredflag = empty then
put"MemoNotesΓäó Hypernote System"&return after NoteText
put"©1988 PeterFraterdeus"&return after NoteText
put"CIS 73306,2703"&return after NoteText
put"ShareWare-$20. to: "&return after NoteText
put"Alphabets, Inc."&return after NoteText
put"Box 5448"&return after NoteText
put"Evanston, Illinois"&return after NoteText
put"60204-5448"&return after NoteText
end if
put NoteText into card field FieldName
--ΓÇóMake Note Field
--ΓÇó Make Buttons
put 0 into DoMeExtn
if DoMeFlag then put 20 into DoMeExtn -- make the button longer
drag from HMouse,VMouse to¬ -- Draw the new NoteButton
HMouse+70 + DoMeExtn,VMouse+16 with commandKey
drag from HMouse+fieldWidth,¬ -- the new GrowButton
VMouse+fieldHeight to HMouse+fieldWidth -16,¬ -- NoteField ID+2
VMouse+fieldHeight+16 with commandKey
choose browse tool -- this actually enables the new button so that
-- its properties may be set...
put "card button (ButtonNum +1)" into it
set name of it to "Note" -- The name must contain the word Note
show it -- to be recognized, but may also include
set style of it to Rectangle -- other words (as "Phone Note", etc.)
set autohilite of it to false
set hilite of it to true
set showname of it to true
if DoMeFlag is True then set name of it to "Do Me Note"
put "card button (ButtonNum +2)" into it -- the Grow button
set name of it to "Grow" --
show it --
set style of it to Rectangle --
set autohilite of it to false
set hilite of it to true
set the icon of it to 1018 -- marker cross
--ΓÇó Make Buttons
-- *** Building the ButtonScript ***
if DoMeFlag contains "true" then
put"*DoMeNoteButtonScript*"&gVersionID&return into NoteButtonScript
put"on MouseDown"&return after NoteButtonScript
put" global gSelection"&return after NoteButtonScript
put" put selection into gSelection"&return after NoteButtonScript
put" pass mousedown"&return after NoteButtonScript
put"end MouseDown"&return after NoteButtonScript
put""&return after NoteButtonScript
put"on MouseUp"&return after NoteButtonScript
put" send DoMeMouseUp"&return after NoteButtonScript
put"end MouseUp"&return after NoteButtonScript
put""&return after NoteButtonScript
put"****"&return after NoteButtonScript
put"Do Me Notes™ ©1988"&return after NoteButtonScript
put"Interactive Fields from MemoNotes"&return after NoteButtonScript
else -- default NoteButton
put"*NoteButtonScript*"&gVersionID&return into NoteButtonScript
put"on mouseup"&return after NoteButtonScript
put" send NoteButtonMouseUp"&return after NoteButtonScript
put"end MouseUp"&return after NoteButtonScript
put""&return after NoteButtonScript
end if -- end DoMeFlag
put"****This note created"&&the date & return after NoteButtonScript
put"MemoNotesΓäó Hypernote system"&return after NoteButtonScript
put"©1988 PeterFraterdeus"&return after NoteButtonScript
put"CIS 73306,2703"&return after NoteButtonScript
put"ShareWare-$20. to: Alphabets, Inc."&return after NoteButtonScript
put"Box 5448/ Evanston, IL. 60204-5448"&return after NoteButtonScript
choose button tool
set script of card button (buttonNum +1) to NoteButtonScript--1st Btn.
put"NoteGrowButton"&gVersionID&return into NoteButtonScript
put"**"&return after NoteButtonScript
put"on mousedown"&return after NoteButtonScript
put" send NoteGrowMouseDown"&return after NoteButtonScript
put"end mousedown"&return after NoteButtonScript
put"***"&return after NoteButtonScript
put"on mouseup"&return after NoteButtonScript
put" send NoteGrowMouseUp"&return after NoteButtonScript
put"end mouseUp"&return after NoteButtonScript
put"****"&return after NoteButtonScript
put"on showGrow"&return after NoteButtonScript
put" send showGrowButton"&return after NoteButtonScript
put"end showGrow"&return after NoteButtonScript
put""&return after NoteButtonScript
put"MemoNotesΓäó Hypernote system"&return after NoteButtonScript
put"©1988 PeterFraterdeus"&return after NoteButtonScript
put"CIS 73306,2703"&return after NoteButtonScript
put"ShareWare-$20. to: Alphabets, Inc."&return after NoteButtonScript
put"Box 5448/ Evanston, IL. 60204-5448"&return after NoteButtonScript
choose browse tool
set script of card button (buttonNum +2) to NoteButtonScript-- 2nd Btn
set cursor to 1
choose browse tool
set cursor to 1
set the userlevel to templevel
set lockscreen to false
click at the loc of card field FieldName
click at the loc of card field FieldName
type tab
type tab with shiftKey
end MemoNote
***********************
on DoMeMouseUp -- Command-Click to do Field
global gmoveNote
global gDoMeNoteRequireCmd -- Default is True
if gmoveNote is true or the optionKey is down or (the commandkey is up and gDoMeNoteRequireCmd is true) then
NoteButtonMouseUp
exit DoMeMouseUp
end if
DoField
end DoMeMouseUp
on DoField
global gSelection
get gSelection
put the id of the target - 1 into ID -- ver 4.0 refs
if gSelection is empty then
get card field id ID
end if
put "on Perform " & return before it
put return&" end Perform " & return after it
put "on closefield " & return after it
put "send DoMeCloseField " & return after it
put "end closefield" & return after it
put "on MouseDown"&return after it
put "send NoteFieldMouseDown"&return after it
put "end MouseDown"&return after it
set the script of card field id ID to it
send Perform to card field id ID
end DoField
on DoMeCloseField -- should be an XCMD... Prettifies DoMe Fields
-- Doesn't work yet with ΓÇ£if--then--actionΓÇ¥ all on one line...
put " " into cTab
put the length of cTab into LnthcTab
put "" into ntab
put the id of the target into it
put card field id it into tempText
if the number of lines in tempText >50 then exit DoMeClosefield
-- takes too long....
repeat with i=1 to the number of lines in tempText
repeat while char 1 of line i of tempText =" "
delete char 1 of line i of tempText
end repeat
end repeat
repeat with i =1 to the number of lines in tempText
if word 1 of line i of tempText is in "on,if,repeat,else" then
put cTab before nTab
end if
if word 1 of line i +1 of tempText is in "end,else" then
delete char 1 to LnthcTab of nTab
end if
put ntab before word 1 of line i +1 of tempText
end repeat
put temptext into card field id it
end DoMeCloseField
on noteFieldMouseDown -- cmdKey-click to bring field to Front
-- This works in Version 4.1.1 or later
set lockscreen to true
put the id of the target into MyId
put card field id (myID) into tempText
choose field tool
click at the loc of card field id (myID)
domenu "cut field"
domenu "paste field"
choose button tool
click at the loc of card button ID (myID+1)
domenu "cut button"
domenu "paste button"
click at the loc of card button ID (myID+2)
domenu "cut button"
domenu "paste button"
choose browse tool
put tempText into card field (the number of card fields)
end noteFieldMouseDown
on showGrowButton
put the rect of the target into myRect
get the rect of card field id (the id of the target -2)
put item 3 of it -17 into item 1 of myRect
put item 4 of it into item 2 of myRect
put item 3 of it into item 3 of myRect
put item 4 of it +17 into item 4 of myRect
set the rect of the target to myRect
set the visible of the target to true
end showGrowButton
***
on showField showing
global gMoveNote,dH,dV
put the id of the target into myID
if the paramcount=0 then put true into showing--1 Feb chngd. to "true"
if (showing=false and gMoveNote = false) or (showing=true and gMoveNote = true) then
-- if the field isn't showing and the button hasn't been moved
-- then show the field in its present location
-- or if the field is showing but the button has been moved
-- then reshow the field in its new location
doHilite true
get the rect of the target
put it into bRect
--if card button id (myID +1) Γëá empty then get the rect of card button id (myID +1)
put gethv ("card field id "&&(myID -1)) into temp
set the rect of card field id (myID -1) to item 1 of bRect,item 4 of bRect, item 1 of bRect+dH,item 4 of bRect+dV
show card field id (myID -1)
send showGrow to card button id (myID +1)
else
doHilite false
hide card field id (myID -1)
hide button id (myID +1)
end if
end showField
***
on NoteGrowMouseUp --
global gMoveNote
put true into gMoveNote
put the rect of the target into myRect
put the id of the target into myID
get the rect of card field id (myID -2)--
put item 3 of myRect into item 3 of it
put item 2 of myRect into item 4 of it
set the rect of card field id (myID -2) to it
put the visible of card field id (myID -2) into showing
send showfield to card button id (myID -1)
end NoteGrowMouseUp
***
on NoteGrowMouseDown
global DragRect, ClipRect,screenRect
put the rect of card field id (the id of the target -2) into clipRect
put item 1 to 2 of clipRect into dragRect
put ","&item 3 to 4 of screenRect after dragRect
repeat while the mouse is down and pointinRect (the mouseLoc, the rect of the target)
end repeat
repeat until the mouse is up -- doDragButton
get the mouseLoc
if pointinRect (it, dragRect) then set the loc of target to it
end repeat
end NoteGrowMouseDown
***
***********************
on ShowNotes -- 7 Jan '88 by Peter Fraterdeus (ver 2.11 -- 25jan88)
-- Part of the MemoNotesΓäó system
--ΓÇóSends a showField message to any button named "Note" on a card
-- thus toggling the visiblity of the Note Fields on the card
set lockscreen to true
global HideAll
if hideall is empty then put false into hideall
put "showField"&& (not Hideall) into doWhat
put (not Hideall) into hideAll
repeat with btn=1 to the number of card buttons
get the name of card button btn
if line 1 of the script of it contains "NoteButtonScript*" then
send doWhat to card button btn -- if this causes a problem
-- make sure the MemoNoteButton is in the Background!
-- Also, any buttons from earlier versions of MemoNotes
-- or buttons with the word NOTE in them (ie. "Go MemoNoteStack",
-- or other people's stacks), that don't know about showField
-- will not like the ShowNote message.
-- If necessary, add the following to the offending button script.
-- on showfield -- (Remove the dashes, of course…)
-- end showfield -- (…and these parenthetical notes)
end if
end repeat
end ShowNotes
***********************
on mousedown -- 6 Jan 88 - ToggleFieldStyle by Peter Fraterdeus
set lockScreen to true
put the userlevel into templevel
set userlevel to 5
magicCopy
get the name of the target
if it contains "Field" then
if the shiftKey is down and the commandKey is down then
get style of the target
if it <>"Scrolling" then
set style of the target to scrolling
else
set style of the target to rectangle -- change for a different
end if -- default rect.
end if
else
if it contains "card button" and it contains "Note" then
set lockScreen to false
MoveNote
set the userlevel to templevel
exit to hypercard
end if
end if
set the userlevel to templevel
end mousedown
**********************
on MoveNote
global gMoveNote, screenRect, clipRect, dragRect
put false into gMoveNote
put "6,7,506,333" into dragRect
put the loc of the target into temp
repeat while the mouse is down and pointinRect (the mouseLoc, the rect of the target)
end repeat
repeat until the mouse is up -- doDragButton
get the mouseLoc
if pointinRect (it, dragRect) then set the loc of target to it
end repeat
if the loc of the target Γëá temp then put true into gMoveNote
-- one of the great qualities of
-- object based environments....
send mouseup to target -- I borrowed the concept, but the
choose browse tool -- execution is completely my design...
end moveNote
**********************
on doHilite OnOff -- onOff must be either True or False if it exists
if the paramcount = 0 then
set the hilite of the Target to not the hilite of the Target
else
set the hilite of the Target to onOff
end if
end doHilite
**********************
on MagicCopy -- Magic Button Copy by Peter Fraterdeus
if the shiftKey is down and the optionKey is down and word 2 of the name of the target is "Button"then
choose button tool
click at the loc of the target -- Shift-Opt.Click to copy button*
domenu copy button
put the short name of the target&&"Button copied..." into msg
choose browse tool
exit to hyperCard
end if
end MagicCopy
***********************
on enterkey -- Toggle Browse-Button-Field Tools with EnterKey+Shift
-- I got this out of Macazine, I believe, from Jerry Daniels and added
-- the ShiftKey modifier
if the userlevel <4 then exit enterkey
if the shiftKey is down then
if the tool is "browse tool" then choose button tool
else if the tool is "button tool" then choose field tool
else choose browse tool
end if
end enterkey
***********************
These are just some little helpers for finding the name and sizes
of objects
***********************
on showRect targ
put the rect of targ into msg
end showRect
on getSName targ
put the short name of targ into msg
end getSName
on getName targ
put the name of targ into msg
end getName
function getRect targ
return the rect of targ
end getRect
on showHV targ
global dH,dV
put getRect(targ) into msg
put getHV(targ) into temp
put "-"&&dH && dV after msg
end showHV
function getHV targ
global dH,dV
get the rect of targ
put item 3 of it - item 1 of it into dH
put item 4 of it - item 2 of it into dV
return true
end getHV
function PointinRect apoint,aRect
if item 1 of apoint >= item 1 of aRect and item 1 of apoint <= item 3 of aRect and item 2 of apoint >= item 2 of aRect and item 2 of apoint <= item 4 of aRect
then return true
else
return false
end if
end PointinRect
***********************
>MemoNote --4.1.1 ***Required Delimiter for MemoNotes Installer***********************